package com.hunlian.makelove.common;

import java.util.ArrayList;

import android.app.Activity;

public class ActivityMgr {
	private static ActivityMgr activityMgr = null;
	private ArrayList<Activity> arr;
	
	public ActivityMgr(){
		arr = new ArrayList<Activity>();
	}
	
	public static ActivityMgr getActivityMgr(){
		if(activityMgr == null){
			activityMgr = new ActivityMgr();
		}
		
		return activityMgr;
	}
	
	public void clear(){
		arr.clear();
	}
	
	public boolean finishAll() {
		for(Activity act : arr){
			if(act != null){
				act.finish();
			}
		}
		
		arr.clear();
		return true;
	}
	
	public void add(Activity act){
		arr.add(act);
	}
	
	public void remove(Activity activity){
//		for(Activity act : arr){
//			if(activity == act){
//				arr.remove(activity);
//			}
//		}
		arr.remove(activity);
	}
}
